package com.bat.spring.beanlifecycle;

import com.bat.spring.normalbean.AppleService;
import com.bat.spring.normalbean.NormalBeanAppConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author: liusen
 * @date: 2022-04-10
 * @desc:
 **/
@Configuration
@ComponentScan("com.bat.spring.beanlifecycle")
public class LifecCycleAppConfig {


	public static void main(String[] args) {

		System.out.println("开始初始化容器");
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(LifecCycleAppConfig.class);
		System.out.println("xml加载完毕");
		Person person1 = (Person) context.getBean("person");
		System.out.println(person1.toString());
		System.out.println("关闭容器");
		context.close();

		//System.out.println(context.getBean(LifeCycleBean.class));
	}
}
